home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-27 | 1.1 KB | 61 lines | [TEXT/KAHL] |
- {
- static long saved_usp;
- #ifdef MMU68040
- cpusha();
- #endif
- pflusha();
- /* save the current context */
- {
- struct userregs save;
- asm {
- movem.l d0-d7/a0-a5,save.save
- move.l (a6),save.save[14]
- move.w 4(a6),save.flags
- move.l 6(a6),save.pc
- };
- SetCurrentA5();
- save.save[15] = usp();
- if (0x2000&~save.flags)
- {
- if (virtual) put_usp(saved_usp);
- crp->registers = save;
- crp->state = 'D';
- }
- else crp->state = 'R';
- if (virtual)
- {
- asm
- {
- move.w save.flags,sr
- }
- }
- }
- memcpy(system_vectors, supervisor_vectors, vec_patch_size);
- sched();
- /* restore the chosen context */
- {
- struct userregs save;
- put_user_root((long)crp);
- if (virtual)
- {
- EnterSupervisorMode();
- saved_usp = usp();
- }
- else upper_space(crp, crp->stack_limit-save.save[15]+stack_headroom);
- save = crp->registers;
- put_usp(save.save[15]);
- memcpy(system_vectors, user_vectors, vec_patch_size);
- cpusha();
- pflusha();
- asm
- {
- move.l save.save[14],(a6)
- move.w save.flags,4(a6)
- move.l save.pc,6(a6)
- movem.l save.save,d0-d7/a0-a5
- unlk a6
- rte
- };
- }
- }
-